package tw.com.msig.b2c.car.setting.service.impl;

import java.util.List;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import tw.com.msig.b2c.car.setting.dao.CityDao;
import tw.com.msig.b2c.car.setting.service.CityService;
import tw.com.msig.b2c.car.setting.vo.CityVo;

public class CityServiceImpl implements CityService {
	
	private Logger log = LoggerFactory.getLogger(this.getClass());
	
	private CityDao cityDao;

	public CityDao getCityDao() {
		return cityDao;
	}
	public void setCityDao(CityDao cityDao) {
		this.cityDao = cityDao;
	}
	
	@Override
	public List<CityVo> getAll() {
		return cityDao.findAll();
	}
	
	@Override
	public CityVo getById(long id) {
		return cityDao.findById(id);
	}
	@Override
	public void insert(CityVo cityVo) {
		cityDao.insert(cityVo);
		
	}
	@Override
	public void update(CityVo cityVo) {
		CityVo dbVo = cityDao.findById(cityVo.getId());
		dbVo.setName(cityVo.getName());		
		cityDao.update(dbVo);		
	}
	@Override
	public void delete(CityVo cityVo) {
		cityDao.delete(cityVo);		
	}	

}
